﻿using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

namespace TdolDemo_QBZ.Models
{
    public partial class sqltestContext : DbContext
    {
        public sqltestContext()
        {
        }

        public sqltestContext(DbContextOptions<sqltestContext> options)
            : base(options)
        {
        }

        public virtual DbSet<TbTdolAvailabilityCheck> TbTdolAvailabilityCheck { get; set; }
        public virtual DbSet<TbTdolAvailabilityUnits> TbTdolAvailabilityUnits { get; set; }
        public virtual DbSet<TbTdolRoles> TbTdolRoles { get; set; }
        public virtual DbSet<TbTdolTaskList> TbTdolTaskList { get; set; }
        public virtual DbSet<TbTdolTaskUnits> TbTdolTaskUnits { get; set; }
        public virtual DbSet<TbTdolTdparrangement> TbTdolTdparrangement { get; set; }
        public virtual DbSet<TbTdolTdparrangementDetail> TbTdolTdparrangementDetail { get; set; }
        public virtual DbSet<TbTdolTdpinfo> TbTdolTdpinfo { get; set; }
        public virtual DbSet<TbTdolTdproles> TbTdolTdproles { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
//#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
                optionsBuilder.UseSqlServer("Server=118.190.110.13,1433;Database=sqltest;user id=SA;password=Qb123456.");
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<TbTdolAvailabilityCheck>(entity =>
            {
                entity.ToTable("TB_TDOL_Availability_Check");

                entity.Property(e => e.Id).HasColumnName("ID");

                entity.Property(e => e.CreateBy).HasMaxLength(50);

                entity.Property(e => e.CreateOn).HasColumnType("datetime");

                entity.Property(e => e.Tdpid).HasColumnName("TDPId");

                entity.Property(e => e.TimeStamp).IsRowVersion();

                entity.Property(e => e.UpDateBy).HasMaxLength(50);

                entity.Property(e => e.UpdateOn).HasColumnType("datetime");
            });

            modelBuilder.Entity<TbTdolAvailabilityUnits>(entity =>
            {
                entity.ToTable("TB_TDOL_AvailabilityUnits");

                entity.Property(e => e.Id).HasColumnName("ID");

                entity.Property(e => e.CheckId).HasColumnName("CheckID");

                entity.Property(e => e.CreateBy).HasMaxLength(50);

                entity.Property(e => e.CreateOn).HasColumnType("datetime");

                entity.Property(e => e.TimeStamp).IsRowVersion();

                entity.Property(e => e.UpDateBy).HasMaxLength(50);

                entity.Property(e => e.UpdateOn).HasColumnType("datetime");
            });

            modelBuilder.Entity<TbTdolRoles>(entity =>
            {
                entity.HasKey(e => e.RoleId);

                entity.ToTable("TB_TDOL_Roles");

                entity.Property(e => e.RoleId).ValueGeneratedNever();

                entity.Property(e => e.Remarks).HasMaxLength(50);

                entity.Property(e => e.RoleName)
                    .IsRequired()
                    .HasMaxLength(30)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<TbTdolTaskList>(entity =>
            {
                entity.HasKey(e => e.TaskId);

                entity.ToTable("TB_TDOL_TaskList");

                entity.Property(e => e.CreateBy)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.CreateOn).HasColumnType("datetime");

                entity.Property(e => e.Description).HasMaxLength(500);

                entity.Property(e => e.OpenIntervalEnd).HasColumnType("datetime");

                entity.Property(e => e.OpenIntervalStart).HasColumnType("datetime");

                entity.Property(e => e.Remarks).HasMaxLength(500);

                entity.Property(e => e.TimeStamp).IsRowVersion();

                entity.Property(e => e.UpdateBy)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UpdateOn).HasColumnType("datetime");
            });

            modelBuilder.Entity<TbTdolTaskUnits>(entity =>
            {
                entity.HasKey(e => e.UnitId);

                entity.ToTable("TB_TDOL_TaskUnits");

                entity.Property(e => e.CreateBy)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.CreateOn).HasColumnType("datetime");

                entity.Property(e => e.TimeStamp).IsRowVersion();

                entity.Property(e => e.UpdateBy)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UpdateOn).HasColumnType("datetime");

                entity.Property(e => e.WorkUnitTime).HasColumnType("datetime");
            });

            modelBuilder.Entity<TbTdolTdparrangement>(entity =>
            {
                entity.HasKey(e => e.ArrangementId);

                entity.ToTable("TB_TDOL_TDPArrangement");

                entity.Property(e => e.ConfirmedByTdp).HasColumnName("ConfirmedByTDP");

                entity.Property(e => e.ConfirmedByTdptime)
                    .HasColumnName("ConfirmedByTDPTime")
                    .HasColumnType("datetime");

                entity.Property(e => e.CreateBy)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.CreateOn).HasColumnType("datetime");

                entity.Property(e => e.ReleaseToTdp).HasColumnName("ReleaseToTDP");

                entity.Property(e => e.ReleaseToTdptime)
                    .HasColumnName("ReleaseToTDPTime")
                    .HasColumnType("datetime");

                entity.Property(e => e.Tdpid).HasColumnName("TDPId");

                entity.Property(e => e.TimeStamp).IsRowVersion();

                entity.Property(e => e.UpdateBy)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UpdateOn).HasColumnType("datetime");
            });

            modelBuilder.Entity<TbTdolTdparrangementDetail>(entity =>
            {
                entity.HasKey(e => e.ArrangementDetailId)
                    .ForSqlServerIsClustered(false);

                entity.ToTable("TB_TDOL_TDPArrangementDetail");

                entity.Property(e => e.ConfirmedByTdp).HasColumnName("ConfirmedByTDP");

                entity.Property(e => e.ConfirmedByTdptime)
                    .HasColumnName("ConfirmedByTDPTime")
                    .HasColumnType("datetime");

                entity.Property(e => e.CreateBy)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.CreateOn).HasColumnType("datetime");

                entity.Property(e => e.TimeStamp).IsRowVersion();

                entity.Property(e => e.UpdateBy)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UpdateOn).HasColumnType("datetime");
            });

            modelBuilder.Entity<TbTdolTdpinfo>(entity =>
            {
                entity.HasKey(e => e.Tdpid);

                entity.ToTable("TB_TDOL_TDPInfo");

                entity.Property(e => e.Tdpid).HasColumnName("TDPId");

                entity.Property(e => e.BackUpPhone)
                    .HasMaxLength(100)
                    .IsUnicode(false);

                entity.Property(e => e.CreateBy)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.CreateOn).HasColumnType("datetime");

                entity.Property(e => e.CurName)
                    .IsRequired()
                    .HasMaxLength(100);

                entity.Property(e => e.DateOfBrith).HasColumnType("datetime");

                entity.Property(e => e.Email)
                    .IsRequired()
                    .HasMaxLength(100)
                    .IsUnicode(false);

                entity.Property(e => e.FirstName)
                    .IsRequired()
                    .HasMaxLength(100)
                    .IsUnicode(false);

                entity.Property(e => e.Iam).HasColumnName("IAM");

                entity.Property(e => e.Idnumber)
                    .IsRequired()
                    .HasColumnName("IDNumber")
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Idtype).HasColumnName("IDType");

                entity.Property(e => e.IsCb).HasColumnName("IsCB");

                entity.Property(e => e.IsUkvi).HasColumnName("IsUKVI");

                entity.Property(e => e.IsnonBc).HasColumnName("ISNonBC");

                entity.Property(e => e.IsnonExam).HasColumnName("ISNonExam");

                entity.Property(e => e.LastName)
                    .IsRequired()
                    .HasMaxLength(100)
                    .IsUnicode(false);

                entity.Property(e => e.LastTraniningDate).HasColumnType("datetime");

                entity.Property(e => e.MiddleName)
                    .HasMaxLength(100)
                    .IsUnicode(false);

                entity.Property(e => e.Mobile)
                    .IsRequired()
                    .HasMaxLength(100)
                    .IsUnicode(false);

                entity.Property(e => e.PassportCopy).HasMaxLength(180);

                entity.Property(e => e.Password)
                    .IsRequired()
                    .HasMaxLength(100);

                entity.Property(e => e.Photo).HasMaxLength(180);

                entity.Property(e => e.PinCode)
                    .IsRequired()
                    .HasMaxLength(150);

                entity.Property(e => e.Remarks).HasMaxLength(350);

                entity.Property(e => e.StartDate).HasColumnType("datetime");

                entity.Property(e => e.SufEmail)
                    .HasMaxLength(100)
                    .IsUnicode(false);

                entity.Property(e => e.SurName)
                    .IsRequired()
                    .HasMaxLength(100);

                entity.Property(e => e.Tdpnumber)
                    .IsRequired()
                    .HasColumnName("TDPNumber")
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Telephone)
                    .HasMaxLength(100)
                    .IsUnicode(false);

                entity.Property(e => e.TimeStamp).IsRowVersion();

                entity.Property(e => e.UpdateBy)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UpdateOn).HasColumnType("datetime");
            });

            modelBuilder.Entity<TbTdolTdproles>(entity =>
            {
                entity.ToTable("TB_TDOL_TDPRoles");

                entity.Property(e => e.CreateBy)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.CreateOn).HasColumnType("datetime");

                entity.Property(e => e.LastTraindate).HasColumnType("datetime");

                entity.Property(e => e.Tdpid).HasColumnName("TDPId");

                entity.Property(e => e.TimeStamp).IsRowVersion();

                entity.Property(e => e.UpdateBy)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UpdateOn).HasColumnType("datetime");
            });
        }
    }
}
